<template>
	<view class="shop-list">
		<common-line></common-line>
		<commodity-list></commodity-list>
	</view>
</template>

<script>
	import CommonLine from '@/components/common/CommonLine.vue'
	import CommodityList from "@/components/common/CommodityList.vue"
	export default {
		components: {
			CommonLine,
			CommodityList
		},
		data() {
			return {
				topFuncList: {
					currentIndex: -1,
					data: [
						{name:'价格',status:0},
						{name:'折扣',status:0},
						{name:'品牌',status:0}
					]
				}
			}
		},
		methods: {
			changeTap(index) {
				this.topFuncList.currentIndex = index
				let idx = this.topFuncList.currentIndex
				if(this.topFuncList.data[idx].status === 0) {
					this.topFuncList.data.forEach(item => {
						item.status = 0
					})
					this.topFuncList.data[idx].status = 1
					return
				}
				if(this.topFuncList.data[idx].status === 1) {
					this.topFuncList.data[idx].status = 2
					return
				}
				if(this.topFuncList.data[idx].status === 2) {
					this.topFuncList.data[idx].status = 0
					this.topFuncList.currentIndex = -1
				}
				// if(idx === index) {
				//
				// } else {
				// 	this.topFuncList.data.forEach(item => {
				// 		item.status = 0
				// 	})
				// }
			}
		}
	}
</script>

<style scoped>
	
</style>
